Add a gtkx.h header for X11-specific GTK+ api
authorMatthias Clasen <mclasen@redhat.com>
Sat, 29 Jan 2011 19:16:47 +0000 (14:16 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 29 Jan 2011 19:16:47 +0000 (14:16 -0500)
This keeps us from pulling gdkx.h into gtk.h

https://bugzilla.gnome.org/show_bug.cgi?id=640902

15 files changed:
docs/reference/gtk/gtk3.types
docs/reference/gtk/x11.sgml
gtk/Makefile.am
gtk/gtk.h
gtk/gtkplug.c
gtk/gtkplug.h
gtk/gtksocket.c
gtk/gtksocket.h
gtk/gtkwidget.c
gtk/gtkx.h [new file with mode: 0644]
modules/other/gail/gail.c
modules/other/gail/gailtoplevel.c
modules/other/gail/gailwindow.c
tests/testsocket.c
tests/testsocket_common.c

index 47295b1679d05ec142f849de8659abaec1c9e4af..bf2ca649ebc6cf8ee733538348cbb53cfe096a79 100644 (file)
@@ -1,4 +1,4 @@
-#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 #include <gtk/gtkunixprint.h>
 
 gtk_about_dialog_get_type
index 0fede1b7fe445b8d59f03fce8e3bedf6bbd5ce7d..0a8ad33f90e8517391c173086a2393751e4ec483 100644 (file)
@@ -31,6 +31,13 @@ see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
 System interaction</link> in the GDK manual.
 </para>
 
+<para>
+GTK+ includes an cross-process embedding facility in the form of
+the #GtkSocket and #GtkPlug widgets. These are X11-specific, and
+you have to include the <filename>gtk/gtkx.h</filename> header
+to use them.
+</para>
+
 <refsect2 id="x11-cmdline">
 <title>X11-specific commandline options</title>
 
index b4564649dc05251570f2b61c10b789106a2c0d88..508c4aad84eaa5d5a56c044b6568031c41708756 100644 (file)
@@ -144,6 +144,7 @@ endif
 # by configure)
 gtk_public_h_sources =                 \
        gtk.h                   \
+       gtkx.h                  \
        gtkaboutdialog.h        \
        gtkaccelgroup.h         \
        gtkaccellabel.h         \
@@ -866,7 +867,7 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
        && rm -f xgen-gtbc
 
 gtktypefuncs.c: @REBUILD@ stamp-gtktypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile
-       $(AM_V_GEN) echo '#include <gtk/gtk.h>' > xgen-gtfsrc.c && \
+       $(AM_V_GEN) echo '#include <gtk/gtkx.h>' > xgen-gtfsrc.c && \
          ${CPP} $(DEFS) $(INCLUDES) -DGTK_ENABLE_BROKEN $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
          $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
          sort | uniq | \
@@ -969,7 +970,7 @@ Gtk_3_0_gir_SCANNERFLAGS =                  \
 if USE_X11
 Gtk_3_0_gir_SCANNERFLAGS += --add-include-path=$(top_builddir)/gdk/x11
 endif
-Gtk_3_0_gir_SCANNERFLAGS += --c-include="gtk/gtk.h"
+Gtk_3_0_gir_SCANNERFLAGS += --c-include="gtk/gtkx.h"
 Gtk_3_0_gir_INCLUDES = Atk-1.0 Gdk-3.0
 Gtk_3_0_gir_CFLAGS = \
                $(INCLUDES) \
index 6f984eab9d36ab01c532d3a3e4285184fd1e263c..0a72d249cff9dad619d83c6762fbbe54c22b71d9 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
 #include <gtk/gtkpagesetup.h>
 #include <gtk/gtkpapersize.h>
 #include <gtk/gtkpaned.h>
-#include <gtk/gtkplug.h>
 #include <gtk/gtkprintcontext.h>
 #include <gtk/gtkprintoperation.h>
 #include <gtk/gtkprintoperationpreview.h>
 #include <gtk/gtkshow.h>
 #include <gtk/gtksizegroup.h>
 #include <gtk/gtksizerequest.h>
-#include <gtk/gtksocket.h>
 #include <gtk/gtkspinbutton.h>
 #include <gtk/gtkspinner.h>
 #include <gtk/gtkstatusbar.h>
index 8cb9a4e1839620012a944f83c991d27a2d7e0392..b363d1d294499629c39f5d04f3cae8e29f5beedd 100644 (file)
  * SECTION:gtkplug
  * @Short_description: Toplevel for embedding into other processes
  * @Title: GtkPlug
+ * @include: gtk/gtkx.h
  * @See_also: #GtkSocket
  *
- * Together with #GtkSocket, #GtkPlug provides the ability
- * to embed widgets from one process into another process
- * in a fashion that is transparent to the user. One
- * process creates a #GtkSocket widget and passes the
- * ID of that widget's window to the other process,
- * which then creates a #GtkPlug with that window ID.
- * Any widgets contained in the #GtkPlug then will appear
- * inside the first application's window.
+ * Together with #GtkSocket, #GtkPlug provides the ability to embed
+ * widgets from one process into another process in a fashion that is
+ * transparent to the user. One process creates a #GtkSocket widget
+ * and passes the ID of that widget's window to the other process,
+ * which then creates a #GtkPlug with that window ID. Any widgets
+ * contained in the #GtkPlug then will appear inside the first
+ * application's window.
  *
  * The communication between a #GtkSocket and a #GtkPlug follows the
  * <ulink url="http://www.freedesktop.org/Standards/xembed-spec">XEmbed</ulink>
- * protocol. This protocol has also been implemented in other toolkits, e.g.
- * <application>Qt</application>, allowing the same level of integration
- * when embedding a <application>Qt</application> widget in GTK or vice versa.
+ * protocol. This protocol has also been implemented in other toolkits,
+ * e.g. <application>Qt</application>, allowing the same level of
+ * integration when embedding a <application>Qt</application> widget
+ * in GTK+ or vice versa.
  *
  * <note>
- * The #GtkPlug and #GtkSocket widgets are only available when GTK is
- * compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
- * They can only be used on a #GdkX11Display.
+ * The #GtkPlug and #GtkSocket widgets are only available when GTK+
+ * is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
+ * They can only be used on a #GdkX11Display. To use #GtkPlug and
+ * #GtkSocket, you need to include the <filename>gtk/gtkx.h</filename>
+ * header.
  * </note>
  */
 
index f34f6d29aec17893ace85deca93973d84b23554d..77ea08ba063ec3398d81ba2725c87adfad19b6c5 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
+#if !defined (__GTKX_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtkx.h> can be included directly."
 #endif
 
 #ifndef __GTK_PLUG_H__
 #define __GTK_PLUG_H__
 
-#include <gdk/gdk.h>
+#include <gtk/gtk.h>
 
 #ifdef GDK_WINDOWING_X11
 
 #include <gdk/gdkx.h>
 
 #include <gtk/gtksocket.h>
-#include <gtk/gtkwindow.h>
 
 
 G_BEGIN_DECLS
@@ -50,9 +49,9 @@ G_BEGIN_DECLS
 #define GTK_PLUG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PLUG, GtkPlugClass))
 
 
-typedef struct _GtkPlug              GtkPlug;
-typedef struct _GtkPlugPrivate       GtkPlugPrivate;
-typedef struct _GtkPlugClass         GtkPlugClass;
+typedef struct _GtkPlug        GtkPlug;
+typedef struct _GtkPlugPrivate GtkPlugPrivate;
+typedef struct _GtkPlugClass   GtkPlugClass;
 
 
 struct _GtkPlug
@@ -75,26 +74,22 @@ struct _GtkPlugClass
   void (*_gtk_reserved4) (void);
 };
 
-
-GType      gtk_plug_get_type  (void) G_GNUC_CONST;
+GType      gtk_plug_get_type              (void) G_GNUC_CONST;
 
 #ifndef GDK_MULTIHEAD_SAFE
-void       gtk_plug_construct             (GtkPlug         *plug,
-                                          Window           socket_id);
-GtkWidget* gtk_plug_new                   (Window           socket_id);
+void       gtk_plug_construct             (GtkPlug    *plug,
+                                           Window      socket_id);
+GtkWidget *gtk_plug_new                   (Window      socket_id);
 #endif
 
-void       gtk_plug_construct_for_display (GtkPlug         *plug,
-                                          GdkDisplay      *display,
-                                          Window           socket_id);
-GtkWidget* gtk_plug_new_for_display       (GdkDisplay      *display,
-                                          Window           socket_id);
-
-Window     gtk_plug_get_id                (GtkPlug         *plug);
-
-gboolean  gtk_plug_get_embedded (GtkPlug         *plug);
-
-GdkWindow *gtk_plug_get_socket_window (GtkPlug   *plug);
+void       gtk_plug_construct_for_display (GtkPlug    *plug,
+                                           GdkDisplay *display,
+                                           Window      socket_id);
+GtkWidget *gtk_plug_new_for_display       (GdkDisplay *display,
+                                           Window      socket_id);
+Window     gtk_plug_get_id                (GtkPlug    *plug);
+gboolean   gtk_plug_get_embedded          (GtkPlug    *plug);
+GdkWindow *gtk_plug_get_socket_window     (GtkPlug    *plug);
 
 G_END_DECLS
 
index 8b92a23dc7c6d9f340743ff92f9ba6123e26515b..68b1042f9862c9a4dacbc91a06d5fce0e045e870 100644 (file)
  * SECTION:gtksocket
  * @Short_description: Container for widgets from other processes
  * @Title: GtkSocket
+ * @include: gtk/gtkx.h
  * @See_also: #GtkPlug, <ulink url="http://www.freedesktop.org/Standards/xembed-spec">XEmbed</ulink>
  *
- * Together with #GtkPlug, #GtkSocket provides the ability
- * to embed widgets from one process into another process
- * in a fashion that is transparent to the user. One
- * process creates a #GtkSocket widget and passes
- * that widget's window ID to the other process,
- * which then creates a #GtkPlug with that window ID.
- * Any widgets contained in the #GtkPlug then will appear
- * inside the first application's window.
+ * Together with #GtkPlug, #GtkSocket provides the ability to embed
+ * widgets from one process into another process in a fashion that
+ * is transparent to the user. One process creates a #GtkSocket widget
+ * and passes that widget's window ID to the other process, which then
+ * creates a #GtkPlug with that window ID. Any widgets contained in the
+ * #GtkPlug then will appear inside the first application's window.
  *
- * The socket's window ID is obtained by using
- * gtk_socket_get_id(). Before using this function,
- * the socket must have been realized, and for hence,
- * have been added to its parent.
+ * The socket's window ID is obtained by using gtk_socket_get_id().
+ * Before using this function, the socket must have been realized,
+ * and for hence, have been added to its parent.
  *
  * <example>
  * <title>Obtaining the window ID of a socket.</title>
@@ -79,9 +77,9 @@
  * gtk_widget_show (socket);
  * gtk_container_add (GTK_CONTAINER (parent), socket);
  *
- * /<!---->* The following call is only necessary if one of
+ * /&ast; The following call is only necessary if one of
  *  * the ancestors of the socket is not yet visible.
- *  *<!---->/
+ *  &ast;/
  * gtk_widget_realize (socket);
  * g_print ("The ID of the sockets window is %#x\n",
  *          gtk_socket_get_id (socket));
  * </example>
  *
  * Note that if you pass the window ID of the socket to another
- * process that will create a plug in the socket, you
- * must make sure that the socket widget is not destroyed
- * until that plug is created. Violating this rule will
- * cause unpredictable consequences, the most likely
- * consequence being that the plug will appear as a
- * separate toplevel window. You can check if the plug
- * has been created by using gtk_socket_get_plug_window(). If
- * it returns a non-%NULL value, then the plug has been
+ * process that will create a plug in the socket, you must make
+ * sure that the socket widget is not destroyed until that plug
+ * is created. Violating this rule will cause unpredictable
+ * consequences, the most likely consequence being that the plug
+ * will appear as a separate toplevel window. You can check if
+ * the plug has been created by using gtk_socket_get_plug_window().
+ * If it returns a non-%NULL value, then the plug has been
  * successfully created inside of the socket.
  *
- * When GTK+ is notified that the embedded window has been
- * destroyed, then it will destroy the socket as well. You
- * should always, therefore, be prepared for your sockets
- * to be destroyed at any time when the main event loop
- * is running. To prevent this from happening, you can
- * connect to the #GtkSocket::plug-removed signal.
+ * When GTK+ is notified that the embedded window has been destroyed,
+ * then it will destroy the socket as well. You should always,
+ * therefore, be prepared for your sockets to be destroyed at any
+ * time when the main event loop is running. To prevent this from
+ * happening, you can connect to the #GtkSocket::plug-removed signal.
  *
  * The communication between a #GtkSocket and a #GtkPlug follows the
  * <ulink url="http://www.freedesktop.org/Standards/xembed-spec">XEmbed</ulink>
- * protocol. This protocol has also been implemented in other toolkits, e.g.
- * <application>Qt</application>, allowing the same level of integration
- * when embedding a <application>Qt</application> widget in GTK or vice versa.
+ * protocol. This protocol has also been implemented in other toolkits,
+ * e.g. <application>Qt</application>, allowing the same level of
+ * integration when embedding a <application>Qt</application> widget
+ * in GTK or vice versa.
  *
  * <note>
- * The #GtkPlug and #GtkSocket widgets are only available when GTK is
- * compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
- * They can only be used on a #GdkX11Display.
+ * The #GtkPlug and #GtkSocket widgets are only available when GTK+
+ * is compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
+ * They can only be used on a #GdkX11Display. To use #GtkPlug and
+ * #GtkSocket, you need to include the <filename>gtk/gtkx.h</filename>
+ * header.
  * </note>
  */
 
index c5be024abfffe4f5d61188daab41384eae90c399..2415b142d92f16d45846465b19df8d1a1f48e6f4 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
+#if !defined (__GTKX_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtkx.h> can be included directly."
 #endif
 
 #ifndef __GTK_SOCKET_H__
 #define __GTK_SOCKET_H__
 
-#include <gdk/gdk.h>
+#include <gtk/gtk.h>
 
 #ifdef GDK_WINDOWING_X11
 
 #include <gdk/gdkx.h>
-#include <gtk/gtkcontainer.h>
 
 G_BEGIN_DECLS
 
@@ -72,14 +71,12 @@ struct _GtkSocketClass
   void (*_gtk_reserved4) (void);
 };
 
-
-GType          gtk_socket_get_type (void) G_GNUC_CONST;
-GtkWidget*     gtk_socket_new      (void);
-
-void            gtk_socket_add_id (GtkSocket       *socket_,
-                                  Window            window);
-Window          gtk_socket_get_id (GtkSocket       *socket_);
-GdkWindow*      gtk_socket_get_plug_window (GtkSocket       *socket_);
+GType      gtk_socket_get_type        (void) G_GNUC_CONST;
+GtkWidget *gtk_socket_new             (void);
+void       gtk_socket_add_id          (GtkSocket *socket_,
+                                       Window     window);
+Window     gtk_socket_get_id          (GtkSocket *socket_);
+GdkWindow *gtk_socket_get_plug_window (GtkSocket *socket_);
 
 G_END_DECLS
 
index e9ffc383090179312fb22be753e65c997c68b1a5..e77a5fb00c9706fa68561663e0bb51fcec821608 100644 (file)
@@ -63,6 +63,7 @@
 #include "gtkmodifierstyle.h"
 #include "gtkversion.h"
 #include "gtkdebug.h"
+#include "gtkplug.h"
 #include "gtktypebuiltins.h"
 
 
diff --git a/gtk/gtkx.h b/gtk/gtkx.h
new file mode 100644 (file)
index 0000000..8cd4b0f
--- /dev/null
@@ -0,0 +1,29 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __GTK_X_H__
+#define __GTK_X_H__
+
+#define __GTKX_H_INSIDE__
+
+#include <gtk/gtksocket.h>
+#include <gtk/gtkplug.h>
+
+#undef __GTKX_H_INSIDE__
+
+#endif /* __GTK_X_H__ */
index cb121638a90bb22b96a49614def013eeeb8466d0..ce4e6ce55b1fd9da1bc6bdba0220f6b7d99d2769 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 #include "gail.h"
 #include "gailfactory.h"
 
index 83a8583a42c21c1d2ea71e552a26735b4c1f0f96..29ff3a5936c5347dbb48ecbcfa76136f4c6df9cf 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 
 #include "gailtoplevel.h"
 
index 73b19937837aae51240646d08c8ea9941b184865..1dd47b2004aa7c3d41289681cebd276bfd532101 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <string.h>
 
-#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 
 #include "gailwindow.h"
 #include "gailtoplevel.h"
index daa305307156d270143de9f889ead6bd8bab8fd8..f936ae520f91f90737ac5a11d6809f1bef64bc1f 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 
 #include <string.h>
 #include <stdlib.h>
index 995dbf9ee452716f8d6dc53b446955f3ce412746..510d6ffdbe8e0b94c76d29f82b179d94ccc9f4d3 100644 (file)
@@ -21,7 +21,7 @@
 #include "config.h"
 #include <gtk/gtk.h>
 #if defined (GDK_WINDOWING_X11)
-#include "x11/gdkx.h"
+#include <gtk/gtkx.h>
 #elif defined (GDK_WINDOWING_WIN32)
 #include "win32/gdkwin32.h"
 #endif